package com.wanghuadi.beans;

/**
 * 性别枚举类
 *
 *      (1)性别枚举类的元素有：男，女
 */
public enum Gender {

    NAN("男"),NV("女");
    private String name;

    private Gender(String name){
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public static Gender getByName(String name){
        Gender[] values = Gender.values();
        for (Gender value : values) {
            if(name.equals(value.getName())){
                return value;
            }
        }
        return null;
    }

}
